﻿using DeviceMaintainGIS.BLL.Repair;
using DeviceMaintainGIS.Common;
using DeviceMaintainGIS.Model;
using DeviceMaintainGIS.Model.Repair;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Script.Serialization;

namespace DeviceMaintainGIS.Controllers
{
    /// <summary>
    /// 售后记录查询
    /// </summary>
    public class RepairInfoController : ApiController
    {
        /// <summary>
        /// 售后记录查询
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public ReturnListVM<AfterSaleRecordResponse> Get([FromUri] AfterSaleRecordRequest request)
        {
            JavaScriptSerializer jsonSerialize = new JavaScriptSerializer();
            String strJson = jsonSerialize.Serialize(request);//输出结果：{"Id":1,"UserName":"张三","Time":"\/Date(1297950721668)\/"}
            string pars = string.Format("售后记录查询：\r\n 时间 = {0};\r\n 参数 = {1};"
            , System.DateTime.Now
            , strJson);
            LogHelper.WriteLog(typeof(FilterConfig), pars);
            return new RepairService().GetAfterSaleRecord(request);
        }



        /// <summary>
        /// 根据售后编号查询售后详细信息
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public ReturnListVM<RepairRelation> Post([FromBody] RepairSelectRequest request)
        {
            JavaScriptSerializer jsonSerialize = new JavaScriptSerializer();
            String strJson = jsonSerialize.Serialize(request);//输出结果：{"Id":1,"UserName":"张三","Time":"\/Date(1297950721668)\/"}
            string pars = string.Format("售后记录查询：\r\n 时间 = {0};\r\n 参数 = {1};"
            , System.DateTime.Now
            , strJson);
            LogHelper.WriteLog(typeof(FilterConfig), pars);
            return new RepairService().GetRepairRelationInfo(request);
        }
    }
}
